<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原型对象创建方法案例</title>
</head>
<body>
    <script>
    // 创建Clothes构造函数
    function Clothes(color, style) {
        this.color = color;
        this.style = style;
}

// 创建两个对象clothes1和clothes2
    var clothes1 = new Clothes('黑色', '连衣裙');
    var clothes2 = new Clothes('黄色', '吊带裙');

// 使用prototype给构造函数添加type属性
    Clothes.prototype.type = '';

// 使用prototype属性，给构造函数Clothes添加Clothes_fun方法
    Clothes.prototype.Clothes_fun = function() {
        return this.color + '的' + this.style;
};

// 设置每个对象的type属性
clothes1.type = '小丽穿的衣服';
clothes2.type = '小美穿的衣服';

// 在页面中输出结果
function displayClothes() {
    document.write(clothes1.Clothes_fun() + '是' + clothes1.type + '</br>');
    document.write(clothes2.Clothes_fun() + '是' + clothes2.type + '</br>');
    document.write(clothes2.type + '是' + clothes2.Clothes_fun());
}

displayClothes();
</script>
</body>
</html>